package main

import (
	"fmt"
	"sort"
)

func main() {
	fmt.Println(findMinArrowShots([][]int{{10, 16}, {2, 8}, {1, 6}, {7, 12}}))
}
func findMinArrowShots(points [][]int) int {
	if len(points) == 0 {
		return 0
	}
	if len(points) == 1 {
		return 1
	}
	sort.Slice(points, func(i, j int) bool { return points[i][1] < points[j][1] })
	maxRight := points[0][1]
	ans := 1
	for _, point := range points {
		if point[0] > maxRight {
			maxRight = point[1]
			ans++
		}
	}
	return ans

}

//10,16
//
//2,8
//
//1,6 =>6,8
//
//7,12 => 12，16
